<template>
  <el-container direction="vertical">
    <el-main>
      <div class="row justify-content-start feature" style="margin-top: 30px">
        <div class="col-sm-6 col-md-5 col-lg-6" v-for="(items,index) in data" :key="index">
          <Store :item="data[index]"></Store>
        </div>
      </div>
    </el-main>
  </el-container>
</template>

<script>
import Store from "../components/Store";
import axios from "axios";
export default {
  name: "Stores",
  components: {Store},
  data(){
    return{
      data:[]
    }
  },
  methods:{

  },
  created() {
    axios.get('http://r44734h518.zicp.vip:41569/store/getAllStore').then(res1=>{
      axios.get('http://r44734h518.zicp.vip:41569/goods/getAllGoods').then(res2=>{
        console.log(res2.data);
        for (var i=0;i<res1.data.length;i++) {
          res1.data[i]['goods'] = [];
          for (var j=0;j<res2.data.length;j++) {
            if (res1.data[i].sid === res2.data[j].sid){
              res1.data[i].goods.push(res2.data[j]);
            }
          }
        }
        this.data = res1.data;
      })
    })
  }
}
</script>

<style scoped>

</style>
